package com.mt.common.core.utils;

import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName: RedissonUtil
 * @Description:
 * @Author zhanghong
 * @Date 2022/5/19
 */
@Component
public class RedissonUtil {
    @Autowired
    private RedissonClient redissonClient;
    public void lock(String key){
        redissonClient.getLock(key).lock();
    }

    public void unlock(String key){
        redissonClient.getLock(key).unlock();
    }
}
